import time
from selenium import webdriver
from selenium.webdriver.common.by import By


# 1 打开浏览器
driver = webdriver.Chrome()

# 2 输入ecshop网址搜索首页
driver.get('https://ecshop.test2.shopex123.com')

# 点击首页
driver.find_element(By.LINK_TEXT, '[ 请登录 ]').click()
time.sleep(2)
# # 3 点击登录
# driver.find_element(By.CLASS_NAME, 'sign').click()

# 4 获取用户名
username = driver.find_element(By.TAG_NAME, 'input')
username.send_keys('奶茶三分甜')

# 5 输入密码
password = driver.find_element(By.NAME, 'password')
password.send_keys('jh194322')

# 6 点击登录
time.sleep(2)
driver.find_element(By.NAME, 'submit').click()

# 7 退出浏览器
time.sleep(2)
driver.quit()